home *** CD-ROM | disk | FTP | other *** search
/ User's Choice Windows CD / User's Choice Windows CD (CMS Software)(1993).iso / win_m_p / mtrash.zip / WWTRASH.TXT < prev    next >
Text File  |  1992-08-27  |  955b  |  44 lines

  1. Declare Function FindWindow Lib "User"(lpClassName As Long, lpWindowName \
  2.   As String) As Integer
  3.  
  4. Sub MAIN
  5. On Error Goto TrashError
  6. Dim x, y, FileLen, ChanNum
  7. NULL = 0
  8. WinName$ = String$(65, 0)
  9. WinName$ = "Steve's McTrash Dumpster"
  10. x = FindWindow(NULL, WinName$)
  11.  
  12. If x = 0 Then
  13.   MsgBox "Steve's McTrash Dumpster is not running; please start it up before using this macro!", \
  14.     "Steve's Mctrash Dumpster Macro", 48
  15.   Goto Done
  16. End If
  17.  
  18. DocName$ = String$(255, 0)
  19. Execute$ = String$(128, 0)
  20. DocName$ = FileName$()
  21. FileLen = Len(FileName$())
  22. DocName$ = Left$(DocName$, FileLen)
  23.  
  24. FileClose 2
  25.  
  26. ChanNum = DDEInitiate("McTrash", "Form1")
  27. Execute$ = "ZAP=" + DocName$
  28. DDEExecute ChanNum, Execute$
  29. DDETerminate ChanNum
  30. Goto Done
  31.  
  32. TrashError:
  33.  
  34. If Err = 503 Then
  35.   Goto Done
  36. Else
  37.   MsgBox "An unknown error has occurred, terminating macro execution",  \
  38.     "Steve's McTrash Dumpster Macro", 64
  39. End If
  40.  
  41. Done:
  42.  
  43. End Sub
  44.